#pragma once
#include <ntifs.h>
#include <io.h>
#include <ntddk.h>
#include <ntstrsafe.h>
#include <stdlib.h>

#include "hook.h"
#include "Reg.h"
#include "Proc.h"
#include "Dir.h"
#include "File.h"
#include "Obj.h"
#include "Ntfs.h"
#include "vol.h"
#include "EnumDrivers.h"
#include "Irp.h"
#include "Km.h"
#include "mem.h"
#include "internal.h"
#include "thr.h"


// REG

#define HOOK_REG_BORRAR_LLAVE \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x902,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_REG_BORRAR_VALORES \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x903,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_REG_INTRODUCIR_VALORES \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x904,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_REG_VER_VALORES \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x905,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_REG_ESCONDER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x916,METHOD_NEITHER,FILE_ANY_ACCESS)

#define DESHACER_HOOKS_REGISTRO \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x906,METHOD_NEITHER,FILE_ANY_ACCESS)

#define KERNEL_REG_MON \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x934,METHOD_NEITHER,FILE_ANY_ACCESS)

#define GET_REG_VALUE_INFORMATION \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x935,METHOD_NEITHER,FILE_ANY_ACCESS)

// PROCESS


#define RECIBIR_BUFFER_KERNEL \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x915,METHOD_NEITHER,FILE_ANY_ACCESS)

#define QUITAR_OFFSET_LIST_ENTRY \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x921,METHOD_NEITHER,FILE_ANY_ACCESS)

#define SUSPENDER_PROCESO \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x929,METHOD_NEITHER,FILE_ANY_ACCESS)

#define RESUMIR_PROCESO \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x930,METHOD_NEITHER,FILE_ANY_ACCESS)

#define TERMINAR_PROCESO \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x931,METHOD_NEITHER,FILE_ANY_ACCESS)


#define MEMORY_INFORMATION \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x932,METHOD_NEITHER,FILE_ANY_ACCESS)


#define KERNEL_PROCESS_EXPLORER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x933,METHOD_NEITHER,FILE_ANY_ACCESS)



// FILES AND DIRS


#define HOOK_BORRAR_DRIVER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x909,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_BORRAR_CARPETA \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x910,METHOD_NEITHER,FILE_ANY_ACCESS)

#define DESHACER_HOOKS_DIR \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x911,METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_ACCESO_DIR \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x917, METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_LECTURA_ESCRITURA \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x919,METHOD_NEITHER,FILE_ANY_ACCESS)

#define DESHACER_HOOK_LECTURA_ESCRITURA \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x920,METHOD_NEITHER,FILE_ANY_ACCESS)

// OBJECTS

#define HOOK_ACCESO_DEVICE \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x918, METHOD_NEITHER,FILE_ANY_ACCESS)

#define HOOK_OPEN_DEVICES \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x922,METHOD_NEITHER,FILE_ANY_ACCESS)

#define DESHACER_HOOK_OBJETOS \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x923,METHOD_NEITHER,FILE_ANY_ACCESS) 

#define HOOK_LINK_SIMBOLICO \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x924,METHOD_NEITHER,FILE_ANY_ACCESS)

// NTFS SCANNER

#define NTFS_SCANNER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x925,METHOD_NEITHER,FILE_ANY_ACCESS)


// VOL INFO

#define VOLUME_INFORMATION \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x926,METHOD_NEITHER,FILE_ANY_ACCESS)

// DRIVERS KERNELMODE

#define ENUM_DRIVERS_KERNEL \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x927,METHOD_NEITHER,FILE_ANY_ACCESS)

// IRP TEST

#define BORRAR_VIA_IRP \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x928,METHOD_NEITHER,FILE_ANY_ACCESS)



#define KERNEL_OBJECT_MANAGER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x936,METHOD_NEITHER,FILE_ANY_ACCESS)	

#define KERNEL_DRIVER_LIST \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x937,METHOD_NEITHER,FILE_ANY_ACCESS)	

#define GET_KERNEL_FILE_INFORMATION \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x938,METHOD_NEITHER,FILE_ANY_ACCESS)	

#define TERMINATE_PROCESS_INTERNALLY \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x939,METHOD_NEITHER,FILE_ANY_ACCESS)	

#define HIDE_FILE \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x940,METHOD_NEITHER,FILE_ANY_ACCESS)	

// HILOS

#define THREAD_KERNEL_INFORMATION \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x941,METHOD_NEITHER,FILE_ANY_ACCESS)

#define THREAD_KILL_KERNEL \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x942,METHOD_NEITHER,FILE_ANY_ACCESS)

// DRIVER

#define UNLOAD_DRIVER \
	CTL_CODE(FILE_DEVICE_UNKNOWN,0x943,METHOD_NEITHER,FILE_ANY_ACCESS)


#define DISPOSITIVO L"\\Device\\KEMM"
#define LINK L"\\??\\KEMM"
#define SYSCALL_INDEX(a)(*(PULONG)((PUCHAR)a+1))

void ConvertirSysTimeToLocalTime(PLARGE_INTEGER localtime, PTIME_FIELDS timefields);

wchar_t *convertirAnsiToUni(char *buffer);

extern char *RegValoresBuffer;
extern char HelperVariable[0xff];

extern WCHAR UserHelperVariable[0xff];
extern PWCHAR UserModeBuffer;

